package com.api.shopapi.mapper;

import com.api.shopapi.entity.CardStatus;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface CardStatusMapper {

    @Insert("insert into card_status (CardStatusCode,CardNumber,Status,GovernmentCode) values " +
            "(#{cardStatus.CardStatusCode},#{cardStatus.CardNumber},#{cardStatus.Status},#{cardStatus.GovernmentCode})")
    int insert(@Param("cardStatus") CardStatus cardStatus);

    @Update("update card_status set CardNumber=#{cardStatus.CardNumber},Status=#{cardStatus.Status}," +
            "GovernmentCode=#{cardStatus.GovernmentCode} where CardStatusCode=#{cardStatus.CardStatusCode}")
    int update(@Param("cardStatus") CardStatus cardStatus);


    @Select("select * from card_status where CardNumber=#{cardNumber} limit 1")
    CardStatus getByCardNumber(@Param("cardNumber") String cardNumber);


}
